package com.cbgolf.oa.activity.statistics;

import android.os.Bundle;
import com.cbgolf.oa.R;
import com.cbgolf.oa.activity.BaseNewActivity;
import com.cbgolf.oa.contract.IStatisticsContract.IStatisticsPresenter;
import com.cbgolf.oa.contract.IStatisticsContract.IStatisticsView;
import com.cbgolf.oa.contract.IStatisticsContract.IStatisticsWaiter;
import com.cbgolf.oa.event.EventStatistics;
import com.cbgolf.oa.manager.DataManager;
import com.cbgolf.oa.presenter.StatisticsPresenterImp;
import com.cbgolf.oa.util.DataUtil;
import com.cbgolf.oa.views.StatisticsNewView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/**
 * @author lq
 * @date 2018/5/7
 */

public class StatisticsNewActivity extends BaseNewActivity implements IStatisticsWaiter {


  private IStatisticsPresenter presenter;
  private IStatisticsView view;
  private int mType;


  @Override
  public String getActivityTitle() {

    return null;
  }

  @Override
  public void back() {
    finish();
  }

  @Override
  protected int getLayoutId() {
    return R.layout.a_business_statistics;
  }

  @Override
  protected void init(Bundle savedInstanceState) {
    EventBus.getDefault().register(this);
    mType = DataUtil.getIntExtra(getIntent(), DataManager.KEY_TYPE, 0);
    view = new StatisticsNewView(this, this, mType);
    presenter = new StatisticsPresenterImp(view);
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    EventBus.getDefault().unregister(this);
  }

  @Subscribe(threadMode = ThreadMode.MAIN)
  public void requestOver(EventStatistics event) {
    view.requestOver(event);
  }

  @Override
  public void getPointList() {

  }
}
